
<!DOCTYPE html>
<html lang="en-us">
	
<include file="Index/head" />  
<body class="desktop-detected pace-done smart-style-4">

<!-- #HEADER -->
<include file="Index/header" />

	
<!-- END HEADER -->

<!-- #NAVIGATION -->
<!-- Left panel : Navigation area -->
<!-- Note: This width of the aside area can be adjusted through LESS/SASS variables -->
<!-- Left panel : Navigation area -->
<!-- Note: This width of the aside area can be adjusted through LESS variables -->
		
<!-- END NAVIGATION -->
<!-- END NAVIGATION -->
<include file="Index/navigation" />
                
<!-- #MAIN PANEL -->
<div id="main" role="main">

	<!-- RIBBON -->
	<div id="ribbon">

		<!-- breadcrumb -->
		<ol class="breadcrumb">
			<li>{$module_name}</li>
					
		</ol>
	</div>
	<!-- END RIBBON -->

	<!-- #MAIN CONTENT -->

				
	<!-- col -->
    <div id="content">
        <div class="row">
           	<div class="col-xs-12 col-sm-7 col-md-7 col-lg-4">
                <h1 class="page-title txt-color-blueDark">

                    <!-- PAGE HEADER -->
                    <i class="fa-fw fa fa-home"></i> 
                        {$first_title}
                    <span>>  
                        {$second_title}
                    </span>
                </h1>
            </div>
        </div>
        <!-- widget grid -->
		<section id="widget-grid" class="">
				
			<!-- row -->
			<div class="row">
				
				<!-- NEW WIDGET START -->
				<article class="col-sm-12 col-md-12 col-lg-12 sortable-grid ui-sortable">
				
					<!-- Widget ID (each widget will need unique ID)-->
					<div class="jarviswidget" id="wid-id-0" data-widget-editbutton="false" data-widget-togglebutton="false" data-widget-deletebutton="false" data-widget-colorbutton="false" data-widget-custombutton="false" data-widget-sortable="false">
					<!-- widget options:
						usage: <div class="jarviswidget" id="wid-id-0" data-widget-editbutton="false">
				
						data-widget-colorbutton="false"
						data-widget-editbutton="false"
						data-widget-togglebutton="false"
						data-widget-deletebutton="false"
						data-widget-fullscreenbutton="false"
						data-widget-custombutton="false"
						data-widget-collapsed="true"
						data-widget-sortable="false"
				
					-->
						<header role="heading">
							<h2>新建主题</h2>				
						</header>
				
							<!-- widget div-->
							<div role="content">
				
								<!-- widget edit box -->
								<div class="jarviswidget-editbox">
									<!-- This area used as dropdown edit box -->
				
								</div>
								<!-- end widget edit box -->
				
								<!-- widget content -->
								<div class="widget-body">
				
									<form class="form-horizontal" method="post" id="myform" enctype="multipart/form-data">
											
										<fieldset>
											<legend>新建主题</legend>
											<input type="hidden" name="userid" id="user_id" />
                                            <div class="form-group">
												<label class="col-md-2 control-label">主题名称</label>
												<div class="col-md-10">
                                                    <input type='text' name='subject' class='form-control' placeholder="" />
												</div>
											</div>
											<div class="form-group">
												<label class="col-md-2 control-label">内容</label>
												<div class="col-md-10">
													<textarea class="form-control" placeholder="内容" rows="10" name="message"></textarea>
												</div>
											</div>
											<div class="form-group">
												<label class="col-md-2 control-label">图片</label>
												<div class="col-md-10">
													<div class="dropzone needsclick" id="UploadImage">
														<div class="dz-message needsclick">
    														<h3>拖拽文件到虚线框内上传或点击上传文件</h3>
    														<span class="text-danger">(支持多文件同时上传，最大上传文件大小：5 MB)</span>
  														</div>
  														<input type="hidden" name="images" id="file_images" />
													</div>
												</div>
											</div>    
                                            <div class="form-group">
												<label class="col-md-2 control-label">隶属圈子</label>
												<div class="col-md-10">
													<select class="form-control" id="forum_id" name="fid">
                                                        <volist name='forums' id='vo'>
                                                            <option value="{$vo.fid}">{$vo.name}</option>
                                                        </volist>	
													</select>
												</div>
											</div>
											<div class="form-group">
												<label class="col-md-2 control-label">特殊主题</label>
												<div class="col-md-10">
													<label class="radio radio-inline">
                                                        <input type="radio" class="radiobox" value='0' name="isspecial">
                                                        <span>正常</span> 
                                                    </label>
                                                    <label class="radio radio-inline">
                                                    	<input type="radio" class="radiobox" value='1' name="isspecial">
                                                    	<span>活动</span>  
                                                    </label>
                                                    <label class="radio radio-inline">
                                                        <input type="radio" class="radiobox" value='2' name="isspecial">
                                                        <span>悬赏</span> 
                                                    </label>
                                                    <label class="radio radio-inline">
                                                        <input type="radio" class="radiobox" value='3' name="isspecial">
                                                        <span>投票</span> 
                                                    </label>    
												</div>
											</div>
											<div class="form-group">
												<label class="col-md-2 control-label">主题创建者</label>
												<div class="col-md-10">
													<input type="text" name="name" class="form-control" id="user-typeahead" data-provide="typeahead" placeholder="" autocomplete="off"/> 
												</div>
											</div>
											<div class="form-group">
												<label class="col-md-2 control-label">是否显示</label>
												<div class="col-md-10">
                                                    <label class="radio radio-inline">
                                                    	<input type="radio" class="radiobox" value='0' name="invisible">
                                                    	<span>显示</span>  
                                                    </label>
                                                    <label class="radio radio-inline">
                                                        <input type="radio" class="radiobox" value='1' name="invisible">
                                                        <span>隐藏</span> 
                                                    </label>
												</div>
											</div>
											<div class="form-group">
												<label class="col-md-2 control-label">主题状态</label>
												<div class="col-md-10">
													<label class="checkbox-inline">
														<input type="checkbox" value='1' name="issticktop">置顶 
													</label>
													<label class="checkbox-inline">
														<input type="checkbox" value='1' name="isdigest">精华 
													</label>
													<label class="checkbox-inline">
														<input type="checkbox" value='1' name="ishot">热门 
													</label>
													<label class="checkbox-inline">
														<input type="checkbox" value='1' name="ishighlight">高亮推荐
													</label>
													<label class="checkbox-inline">
														<input type="checkbox" disabled="disabled">图文<span class="text-danger">（无须勾选，后台自动识别）</span>
													</label>
												</div>
											</div>
										</fieldset>

										<div class="form-actions">
											<div class="row">
												<div class="col-md-12">
													<a href="{:U('lists')}" class="btn btn-default" type="button" >返回</a>
													<button class="btn btn-primary" type="submit" >保存修改</button>
												</div>
											</div>
										</div>
									</form>
				
								</div>
								<!-- end widget content -->
				
								</div>
								<!-- end widget div -->
				
							</div>
							<!-- end widget -->
				
							
				
						</article>
						<!-- WIDGET END -->
				
					</div>
				
					<!-- end row -->
				
					<!-- end row -->
				
				</section>
				<!-- end widget grid -->

			</div>
				<!-- end col -->
				

			<!-- end row -->
			
			<!-- END #MAIN CONTENT -->

		</div>
                
                    <
		<!-- END #MAIN PANEL -->

		<!-- #PAGE FOOTER -->
		
		<!-- END FOOTER -->
<include file="Index/footer" />


<!-- IMPORTANT: APP CONFIG -->
<script src="{$resource_basic}js/app.config.js"></script>

<!-- JS TOUCH : include this plugin for mobile drag / drop touch events-->
<script src="{$resource_basic}js/plugin/jquery-touch/jquery.ui.touch-punch.min.js"></script> 
		
<!-- JARVIS WIDGETS -->
<script src="{$resource_basic}js/smartwidgets/jarvis.widget.min.js"></script>
<!-- typeahead -->
<script src="{$resource_basic}js/plugin/typeahead/jquery.mockjax.js"></script>		
<script src="{$resource_basic}js/plugin/typeahead/bootstrap-typeahead.min.js"></script>	

<!--dropzone upload file -->
<script src="{$resource_basic}js/dropzone/dropzone.min.js"></script>
<script type="text/javascript">
   $(document).ready(function () {

        Dropzone.options.myAwesomeDropzone = false;
        Dropzone.autoDiscover = false;

        function delstr(str) { 
        	var regex = new RegExp(str.replace('\,','\\\,')); 
        	var ipt = document.getElementById('file_images'); 
        	ipt.value = ipt.value.replace(regex,''); 
        }

        $("div#UploadImage").dropzone({
            url: "{:U('Forum/Thread/upload')}",
            //method: 'post',
            maxFilesize: 20,
            maxFiles: 9,
            addRemoveLinks: true,
            //paramName: "file",//设置传输文件名称参数. 默认是 file
            //uploadMultiple:true,
            //autoProcessQueue:true,//自动上传
            acceptedFiles: "image/jpg, image/jpeg, image/png, image/gif, image/bmp",
            dictFileTooBig: "文件大小超过限制",
            dictRemoveFile:"删除文件",
            maxfilesexceeded: function(file) {
        		alert('仅能上传9张图片');
        		var name = file.name;
                var ref;
                return (ref = file.previewElement) != null ? ref.parentNode.removeChild(file.previewElement) : void 0;
    		},
            init: function() {
            	this.on("success", function(file) {
                	console.log("File " + file.name + "uploaded");
            	});
            	this.on("removedfile", function(file) {
                	console.log("File " + file.name + "removed");
            	});
        	},
        	sending: function(file, xhr, formData) {
      			formData.append("filesize", file.size);
    		},
    		success: function (file, response, e) {
    			file.previewElement.setAttribute("data-id",response);
    			$("#file_images").val($("#file_images").val()+response+",");//input#file_images追加图片id
      			//console.log(response);
    		},
            removedfile: function (file) {
                var name = file.name;
                var ref;
                var id=file.previewElement.getAttribute("data-id");
                delstr(id+",");//input#file_images删除图片id
                return (ref = file.previewElement) != null ? ref.parentNode.removeChild(file.previewElement) : void 0;
            },
            
        });
	});
</script>

<script type="text/javascript">
		
// DO NOT REMOVE : GLOBAL FUNCTIONS!
		
$(document).ready(function() {
			
	pageSetUp();
				
	
});
$(function(){
	//动态加载用户
	function displayResult(item) {
		$("#user_id").val(item.value);//用户id
        //$('.alert').show().html('You selected <strong>' + item.value + '</strong>: <strong>' + item.text + '</strong>');
    }
    $('#user-typeahead').typeahead({
        ajax: {
            url: "{:U('Forum/Common/get_private_user')}",
            method: 'post',
            triggerLength: 1
        },
        displayField: 'nickname',
        valueField: 'userid',
        onSelect: displayResult
    });

});
</script>		
</body>
</html>